home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / dxcmds34.sit / Dartmouth XCMD's 3.4.3 / card_13272.txt < prev    next >
Text File  |  1990-04-17  |  4KB  |  134 lines

  1. -- card: 13272 from stack: in.3
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3241
  5. -- name: SizeCardWindow
  6. ----- HyperTalk script -----
  7. on Install
  8.   get ChooseTargetStack()
  9.   InstallResource XCMD,SizeCardWindow,it
  10. end Install
  11.  
  12.  
  13. -- part 1 (button)
  14. -- low flags: 00
  15. -- high flags: A003
  16. -- rect: left=299 top=300 right=322 bottom=438
  17. -- title width / last selected line: 0
  18. -- icon id / first selected line: 0 / 0
  19. -- text alignment: 1
  20. -- font id: 0
  21. -- text size: 12
  22. -- style flags: 0
  23. -- line height: 16
  24. -- part name: Show Pascal Source
  25. ----- HyperTalk script -----
  26. on mouseUp
  27.   set the visible of card field 1 to not the visible of card field 1
  28.   if the visible of card field 1 is true then
  29.     set the name of me to "Hide Pascal Source"
  30.   else set the name of me to "Show Pascal Source"
  31. end mouseUp
  32.  
  33.  
  34.  
  35. -- part 3 (field)
  36. -- low flags: 81
  37. -- high flags: 2007
  38. -- rect: left=12 top=26 right=298 bottom=491
  39. -- title width / last selected line: 0
  40. -- icon id / first selected line: 0 / 0
  41. -- text alignment: 0
  42. -- font id: 22
  43. -- text size: 10
  44. -- style flags: 0
  45. -- line height: 13
  46. -- part name: Source
  47.  
  48.  
  49. -- part contents for background part 16
  50. ----- text -----
  51. SIZECARDWINDOW XCMD version 1.0
  52. Kevin Calhoun
  53.  
  54. SizeCardWindow sets the size of the HyperCard window.
  55.  
  56. If you make the window larger than the standard size of 512 by 342 pixels, HyperCard is unable to use the extra space (this applies to version 1.2.2 and earlier, and to every version of HyperCard until one, which may or may not someday appear, in which this XCMD becomes obsolete).  SizeCardWindow is only useful for making the window temporarily smaller, which is desirable, for instance, if you want to see other windows.
  57.  
  58. INVOKING SIZECARDWINDOW
  59.  
  60. SizeCardWindow <horizontalSize>,<verticalSize>
  61.  
  62. SizeCardWindow takes zero, one, or two parameters.  If no parameters are passed, SizeCardWindow sets the size of the card window to its standard size, 512 by 342 pixels.  If one parameter is passed, SizeCardWindow makes the window horizontalSize pixels wide and 342 pixels tall.  If two parameters are passed, SizeCardWindow makes the window horizontalSize pixels wide and verticalSize pixels tall.  If either horizontalSize or verticalSize is an empty string, SizeCardWindow substitutes the standard measurement for the dimension it represents.  If either horizontalSize or verticalSize is a negative number, SizeCardWindow does nothing.
  63.  
  64. -- part contents for card part 3
  65. ----- text -----
  66. UNIT GotGrafPortWillWreakHavoc;
  67.  
  68. { SizeCardWindow XCMD ┬⌐1989 by the Trustees of Dartmouth College }
  69. { Written by Kevin Calhoun }
  70.  
  71. { This source compatible with MPW Pascal 3.0 }
  72.  
  73. (*
  74. Pascal SizeCardWindow.p
  75. Link -m ENTRYPOINT Γêé
  76.      -o "YourFile" Γêé
  77.      -rt XCMD=3389 Γêé
  78.      -sn Main=SizeCardWindow Γêé
  79.      SizeCardWindow.p.o Γêé
  80.     "{Libraries}"HyperXLib.o
  81. *)
  82.  
  83. {$R-}
  84.  
  85.   INTERFACE
  86.  
  87.     USES
  88.       Types,
  89.       Windows,
  90.       ToolUtils,
  91.       HyperXCmd;
  92.   
  93.     PROCEDURE EntryPoint(paramPtr: XCMDPtr);
  94.  
  95.   IMPLEMENTATION
  96.  
  97.     PROCEDURE SizeCardWindow(paramPtr: XCMDPtr);
  98.       FORWARD;
  99.  
  100.     PROCEDURE EntryPoint;
  101.  
  102.       BEGIN
  103.         SizeCardWindow(paramPtr);
  104.       END;
  105.     
  106.   PROCEDURE SizeCardWindow(paramPtr: XCMDPtr);
  107.     VAR
  108.       params: INTEGER;
  109.       cardWindow: WindowPtr;
  110.       str: Str255;
  111.       w, h: LONGINT;
  112.   BEGIN
  113.     GetPort(GrafPtr(cardWindow));
  114.     params := paramPtr^.paramCount;
  115.     w := 512;
  116.     h := 342;
  117.     IF params >= 1 THEN
  118.       BEGIN
  119.       ZeroToPas(paramPtr, paramPtr^.params[1]^, str);
  120.       IF LENGTH(str) > 0 THEN w := StrToNum(paramPtr, str);
  121.       IF params = 2 THEN
  122.         BEGIN
  123.         ZeroToPas(paramPtr, paramPtr^.params[2]^, str);
  124.         IF LENGTH(str) > 0 THEN h := StrToNum(paramPtr, str);
  125.         END;
  126.       END;
  127.     IF (w > 0) AND (h > 0) THEN
  128.       SizeWindow(cardWindow, LoWord(w), LoWord(h), TRUE);
  129.     paramPtr^.returnValue :=
  130.       PasToZero(paramPtr,
  131.         'SizeCardWindow XCMD 1.0, 15 March 1989, ┬⌐1989 Dartmouth College');
  132.   END;
  133.   
  134. END.